﻿using JV.Com.Internals;
using JV.Com.ViewModels;
using Microsoft.Practices.Prism.StoreApps;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// Pour en savoir plus sur le modèle d'élément Page vierge, consultez la page http://go.microsoft.com/fwlink/?LinkId=234238

namespace JV.Com.Views
{
    /// <summary>
    /// Une page vide peut être utilisée seule ou constituer une page de destination au sein d'un frame.
    /// </summary>
    public sealed partial class TestGamePage : PageBase
    {
        private TestGamePageViewModel m_context;
        public TestGamePage()
        {
            this.InitializeComponent();
            this.DataContextChanged += TestGamePage_DataContextChanged;
            this.Loaded += TestGamePage_Loaded;
        }

        void TestGamePage_Loaded(object sender, RoutedEventArgs e)
        {
            m_context.TestLoadedEvent += (s, args) =>
            {
                if (m_context.RecapParagraph != null)
                {
                    recapBlock.Blocks.Add(m_context.RecapParagraph);
                }
                testBlock.Blocks.Add(m_context.ContentParagraph);
                m_context.InLoading = false;
            };
        }

        void TestGamePage_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            if (args.NewValue is TestGamePageViewModel)
            {
                m_context = (TestGamePageViewModel)args.NewValue;
            }
        }

        //private RichTextBlock m_recapTextBlock;
        //private void recapBlock_Loaded(object sender, RoutedEventArgs e)
        //{
        //    m_recapTextBlock = (RichTextBlock)sender;
        //}

        //private RichTextBlock m_richTextBlock;
        //private void testBlock_Loaded(object sender, RoutedEventArgs e)
        //{

        //}
    }
}
